package org.example.local;

import org.example.local.event.WeatherEvent;

public class Test {
    public static void main(String[] args) throws InterruptedException {
        TVStation  tvStation = new TVStation();
        WeatherStation weatherStation = new WeatherStation(tvStation);
        User user1 = new User("ybc",(info)->{
            System.out.println("我喜欢晴天,现在是"+info);
        });
        User user2 = new User("ybc",(info)->{
            System.out.println("我喜欢下雨,现在是"+info);
        });
        tvStation.subscribe(user1, WeatherEvent.class);
        tvStation.subscribe(user2,WeatherEvent.class);
        weatherStation.start();

    }
}
